﻿#pragma once

#include "Input/Keys.h"
#include <variant>
#include "Math/IntPoint.h"
#include "Input/MouseButton.h"
#include "Path/Path.h"

struct SSystemKeyboardKeyDown
{
    uint64_t WindowID;
    EKey Key;
};

struct SSystemKeyboardKeyUp
{
    uint64_t WindowID;
    EKey Key;
};

struct SSystemTextInput
{
    uint64_t WindowID;

    //the input text
    CString Text;
};

struct SSystemMouseButtonDown
{
    uint64_t WindowID;
    EMouseButton Button;
    bool DoubleClick=false;
};

struct SSystemMouseButtonUp
{
    uint64_t WindowID;
    EMouseButton Button;
};

struct SSystemMouseWheelRoll
{
    uint64_t WindowID;
    int64_t WheelDistance;
};

struct SSystemMouseMove
{
    uint64_t WindowID;

    //相对于窗口的位置
    SIntPoint MousePosition;

    //鼠标屏幕位置
    SIntPoint ScreenMousePosition;

    //鼠标移动距离
    SIntPoint Delta;
};


struct SSystemDragFileOver
{
    uint64_t WindowID;
    TVector<SPath> FilePaths;
};

struct SSystemDropFiles
{
    uint64_t WindowID;
    TVector<SPath> FilePaths;
};


struct SSystemWindowClose
{
    uint64_t WindowID;
};

struct SSystemWindowResize
{
    uint64_t WindowID;
    SIntPoint NewSize;
};

struct SSystemWindowLostFocus
{
    //失去焦点的窗口ID
    uint64_t WindowID;

    //获得焦点的窗口ID
    uint64_t FocusedWindowID;
};

struct SSystemWindowGotFocus
{
    uint64_t WindowID;
};

struct SSystemClickDisabledWindow
{
    uint64_t WindowID;
};




using SystemEvent = std::variant<
    
    SSystemKeyboardKeyDown,
    SSystemKeyboardKeyUp,
    SSystemTextInput,

    SSystemMouseButtonDown,
    SSystemMouseButtonUp,
    SSystemMouseWheelRoll,
    SSystemMouseMove,
    SSystemDragFileOver,
    SSystemDropFiles,

    SSystemWindowClose,
    SSystemWindowResize,
    SSystemWindowLostFocus,
    SSystemWindowGotFocus,
    SSystemClickDisabledWindow
    >;